FROM ubuntu

ADD ./source.list /etc/apt/sources.list
# System requirements
RUN apt-get update && apt-get install -y \
build-essential \
curl \
python3-pip \
swig \
netcat \
gettext \
&& rm -rf /var/lib/apt/lists/*

# Upgrade pip then install dependencies
RUN pip3 install --upgrade pip
RUN curl https://raw.githubusercontent.com/automl/auto-sklearn/master/requirements.txt \
| xargs -n 1 -L 1 pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple

# Install
RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple \
auto-sklearn

ADD ./requirements.txt /usr/src/app/requirements.txt

RUN pip3 install -r /usr/src/app/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

ENV LIBRARY_PATH=/lib:/usr/lib
WORKDIR /usr/src/app
# add entrypoint.sh
COPY ./entrypoint.sh /usr/src/app/entrypoint.sh
#RUN chmod +x /usr/src/app/entrypoint.sh
RUN ["chmod", "+x", "/usr/src/app/entrypoint.sh"]

# add app
COPY . /usr/src/app

# run server
CMD ["/usr/src/app/entrypoint.sh"]

